CREATE TABLE [dbo].[AddressToUse]
(
[ContactKey] [uniqueidentifier] NOT NULL,
[CommunicationReasonKey] [uniqueidentifier] NOT NULL,
[FullAddressKey] [uniqueidentifier] NOT NULL,
[SeasonalRevertFullAddressKey] [uniqueidentifier] NULL,
[FullAddressText] [nvarchar] (1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[IsOverridden] [bit] NOT NULL CONSTRAINT [DF_AddressToUse_IsOverridden] DEFAULT ((0)),
[MarkedForDeleteOn] [datetime] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AddressToUse] ADD CONSTRAINT [PK_AddressToUse] PRIMARY KEY CLUSTERED ([ContactKey], [CommunicationReasonKey]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[AddressToUse] ADD CONSTRAINT [FK_AddressToUse_CommunicationReasonRef] FOREIGN KEY ([CommunicationReasonKey]) REFERENCES [dbo].[CommunicationReasonRef] ([CommunicationReasonKey])
GO
ALTER TABLE [dbo].[AddressToUse] ADD CONSTRAINT [FK_AddressToUse_ContactMain] FOREIGN KEY ([ContactKey]) REFERENCES [dbo].[ContactMain] ([ContactKey])
GO
ALTER TABLE [dbo].[AddressToUse] ADD CONSTRAINT [FK_AddressToUse_FullAddress] FOREIGN KEY ([FullAddressKey]) REFERENCES [dbo].[FullAddress] ([FullAddressKey])
GO
ALTER TABLE [dbo].[AddressToUse] ADD CONSTRAINT [FK_AddressToUse_FullAddress_SeasonalRevertFullAddress] FOREIGN KEY ([SeasonalRevertFullAddressKey]) REFERENCES [dbo].[FullAddress] ([FullAddressKey])
GO